package psd.model.Prolog.Converters;

import org.eclipse.jdt.core.dom.FieldAccess;

import psd.model.IConverter;
import psd.model.Prolog.FactGenerationToolbox;
import psd.model.Prolog.PrologConverter;


public class PrologFieldAccessConverter extends PrologConverter implements
		IConverter<FieldAccess> {

	public PrologFieldAccessConverter(FactGenerationToolbox toolbox) {
		super(toolbox);
	}

	@Override
	public boolean convert(FieldAccess node) {
		String expr = idResolver.getID(node.getExpression());
		String name = quote(node.getName().getIdentifier());
		String field = idResolver.getID(node.resolveFieldBinding());
		String args[] = { expr, name, field };
		createBodyFact(node, "getFieldT", args);
		writeSourceLocationArgumentIdentifier(node, node.getName());
		return true;
	}

}
